package com.wolfpire.workflow.om;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;


/**
 * 任务管理(历史任务)
 * @author liushx
 *
 */
@Entity
@Table(name = "wf_task")
public class MyTask implements Serializable{
	
	private static final long serialVersionUID = 1066118393258639384L;

	@Id
	@Column(name = "task_id", length = 8)
	private Long taskId;
	
	@Column(name = "TASK_NAME")
	private String taskName;
	
	@Column(name = "NODE_ID", length = 8)
	private Long nodeId;
	
	//任务类型
	@Column(name = "TASK_TYPE")
	private String taskType;
	
	//操作类型
	@Column(name = "OPERATE_TYPE")
	private String operateType;
	
	//@Column(name = "DEPLOYMENT_ID")
	//private Integer deploymentId;
	//
	@Column(name = "INSTANCE_ID")
	private Long instanceId;
	//办理人ID
	@Column(name = "TRANSACTOR_ID")
	private Long transactorId;
	//办理人姓名
	@Column(name = "TRANSACTOR_NAME")
	private String transactorName;
	//办理部门
	@Column(name = "ORG_NAME")
	private String orgName;
	//办理部门id
	@Column(name = "ORG_ID")
	private Long orgId;
	//办理意见
	@Column(name = "REMARKS")
	private String remarks;
	//开始时间
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "START_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date startTime;
	//完成时间
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "END_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date endTime;
	//表单类型ID
	@Column(name = "FORM_TYPE_ID")
	private Long formTypeId;
	//表单ID
	@Column(name = "FORM_ID")
	private Long formId;
	//
	@Column(name = "STATUS")
	private String status;
	//催办人
	@Column(name = "REMINDER")
	private String reminder;
	
	@Temporal(TemporalType.TIME)
	@Column(name = "COMPLETE_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date completeTime;//要求办结时间
	
	@Column(name = "ISTIMEOUT")
	private String isTimeOut;//是否超时（0未超时，1超时）
	
	@Temporal(TemporalType.TIME)
	@Column(name = "RECEIVE_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date receiveTime;// 任务接收时间
	
	
	@Column(name = "ATTACHMENT_IDS")
	private String attIds;//附件
	
	@Column(name = "PRE_TASK_ID")
	private Long preTaskId; // 上一个任务ID
	
	@Column(name = "PRE_USER_ID")
	private Long preUserId; // 上一个任务办理人
	
	@Column(name = "PRE_TASK_NAME")
	private String preTaskName;// 上一个任务名称
	
	@Column(name = "PRE_USER_NAME")
	private String preUserName;// 上一个任务办理人名称
	

	@Transient
	private String proName;//任务名称
	
	@Transient
	private String sponsor;//发起人
	
	@Transient
	private String sponsorOrg;//发起人部门
	
//	@Transient
//	private List<AttachmentFlow> attachmentFlowList = new ArrayList<AttachmentFlow>();
	
	@Transient
	private String formUrl ;		//表单的URL


	public MyTask() {
		super();
	}

	public MyTask(Long taskId, String taskName, Long nodeId, String taskType,
			String operateType, Long instanceId, Long transactorId,
			String transactorName, String orgName, Long orgId, String remarks,
			Date startTime, Date endTime, Long formTypeId, Long formId,
			String status, String attIds, Long preTaskId, Long preUserId,
			String preTaskName, String preUserName, String proName) {
		super();
		this.taskId = taskId;
		this.taskName = taskName;
		this.nodeId = nodeId;
		this.taskType = taskType;
		this.operateType = operateType;
		this.instanceId = instanceId;
		this.transactorId = transactorId;
		this.transactorName = transactorName;
		this.orgName = orgName;
		this.orgId = orgId;
		this.remarks = remarks;
		this.startTime = startTime;
		this.endTime = endTime;
		this.formTypeId = formTypeId;
		this.formId = formId;
		this.status = status;
		this.attIds = attIds;
		this.preTaskId = preTaskId;
		this.preUserId = preUserId;
		this.preTaskName = preTaskName;
		this.preUserName = preUserName;
		this.proName = proName;
	}

	public Long getTaskId() {
		return taskId;
	}

	public void setTaskId(Long taskId) {
		this.taskId = taskId;
	}

	public String getTaskName() {
		return taskName;
	}

	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}

	public Long getNodeId() {
		return nodeId;
	}

	public void setNodeId(Long nodeId) {
		this.nodeId = nodeId;
	}

	public String getTaskType() {
		return taskType;
	}

	public void setTaskType(String taskType) {
		this.taskType = taskType;
	}

	public String getOperateType() {
		return operateType;
	}

	public void setOperateType(String operateType) {
		this.operateType = operateType;
	}

	public Long getInstanceId() {
		return instanceId;
	}

	public void setInstanceId(Long instanceId) {
		this.instanceId = instanceId;
	}

	public Long getTransactorId() {
		return transactorId;
	}

	public void setTransactorId(Long transactorId) {
		this.transactorId = transactorId;
	}

	public String getTransactorName() {
		return transactorName;
	}

	public void setTransactorName(String transactorName) {
		this.transactorName = transactorName;
	}

	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Long getFormTypeId() {
		return formTypeId;
	}

	public void setFormTypeId(Long formTypeId) {
		this.formTypeId = formTypeId;
	}

	public Long getFormId() {
		return formId;
	}

	public void setFormId(Long formId) {
		this.formId = formId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getReminder() {
		return reminder;
	}

	public void setReminder(String reminder) {
		this.reminder = reminder;
	}

	public Date getCompleteTime() {
		return completeTime;
	}

	public void setCompleteTime(Date completeTime) {
		this.completeTime = completeTime;
	}

	public String getIsTimeOut() {
		return isTimeOut;
	}

	public void setIsTimeOut(String isTimeOut) {
		this.isTimeOut = isTimeOut;
	}

	public Date getReceiveTime() {
		return receiveTime;
	}

	public void setReceiveTime(Date receiveTime) {
		this.receiveTime = receiveTime;
	}


	public String getAttIds() {
		return attIds;
	}

	public void setAttIds(String attIds) {
		this.attIds = attIds;
	}

	public String getProName() {
		return proName;
	}

	public void setProName(String proName) {
		this.proName = proName;
	}

	public String getSponsor() {
		return sponsor;
	}

	public void setSponsor(String sponsor) {
		this.sponsor = sponsor;
	}

	public String getSponsorOrg() {
		return sponsorOrg;
	}

	public void setSponsorOrg(String sponsorOrg) {
		this.sponsorOrg = sponsorOrg;
	}

	public String getFormUrl() {
		return formUrl;
	}

	public void setFormUrl(String formUrl) {
		this.formUrl = formUrl;
	}
	
	public String getOperateTypeIndex() {
		
		return operateType==null?"":operateType;
	}

	public Long getPreTaskId() {
		return preTaskId;
	}

	public void setPreTaskId(Long preTaskId) {
		this.preTaskId = preTaskId;
	}

	public Long getPreUserId() {
		return preUserId;
	}

	public void setPreUserId(Long preUserId) {
		this.preUserId = preUserId;
	}

	public String getPreTaskName() {
		return preTaskName;
	}

	public void setPreTaskName(String preTaskName) {
		this.preTaskName = preTaskName;
	}

	public String getPreUserName() {
		return preUserName;
	}

	public void setPreUserName(String preUserName) {
		this.preUserName = preUserName;
	}
	
	
}
